//@charset "utf-8";
// 板块请求
define(function(require, exports, module) {
    var userPath = null;
    var BaseModel = require('../models/clientbase');
    try {
        userPath = external.getUserPath();
        thsPath = userPath + 'customplates\\';
        fis = external.createObject('FileInputStream');
        fos = external.createObject('FileOutputStream');
    } catch (e) {}


    var ClientData = BaseModel.extend({
        getFileContent: function(file) {
            if (null === fis) {
                return false;
            }
            var str = false;
            if (fis.open(thsPath + file)) {
                try {
                    str = fis.readDes();
                } catch (e) {}
            }
            if (false === str) {
                return false;
            }
            return eval('(' + str + ')');
        },
        writeFileContent: function(file, jsonStr) {
            var str = '';
            if (null === fos) {
                return false;
            }
            if (fos.open(thsPath + file)) {
                try {
                    str = fos.writeDes(jsonStr);
                } catch (e) {}
                fos.close();
            }
        }
    });

    module.exports = new ClientData();
});